am4internal_webpackJsonp(["3741"],{"eUZ+":function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={};i.d(r,"ForceDirectedLink",function(){return d}),i.d(r,"ForceDirectedTreeDataItem",function(){return V}),i.d(r,"ForceDirectedTree",function(){return C}),i.d(r,"ForceDirectedNode",function(){return b}),i.d(r,"ForceDirectedSeriesDataItem",function(){return D}),i.d(r,"ForceDirectedSeries",function(){return L});var n=i("m4/l"),a=i("Vs7R"),o=i("aCit"),s=i("MIZb"),l=i("hGwe"),c=i("tjMS"),d=function(e){function t(){var t=e.call(this)||this;t.className="ForceDirectedLink";var i=new s.a;return t.fillOpacity=0,t.strokeOpacity=.5,t.stroke=i.getFor("grid"),t.isMeasured=!1,t.nonScalingStroke=!0,t.interactionsEnabled=!1,t.distance=1.5,t.strength=1,t.applyTheme(),t}return Object(n.c)(t,e),t.prototype.validate=function(){e.prototype.validate.call(this);var t=this.source,i=this.target;t&&i&&(this.path=l.moveTo({x:t.pixelX,y:t.pixelY})+l.lineTo({x:i.pixelX,y:i.pixelY}),t.isHidden||i.isHidden||t.isHiding||i.isHiding?this.hide():this.show())},Object.defineProperty(t.prototype,"source",{get:function(){return this._source},set:function(e){e&&(this._source=e,this._disposers.push(e.events.on("positionchanged",this.invalidate,this,!1)),this._disposers.push(e.events.on("validated",this.invalidate,this,!1)))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e&&(this._target=e,this._disposers.push(e.events.on("positionchanged",this.invalidate,this,!1)),this._disposers.push(e.events.on("validated",this.invalidate,this,!1)))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distance",{get:function(){return this._adapterO&&this._adapterO.isEnabled("distance")?this._adapterO.apply("distance",this.properties.distance):this.properties.distance},set:function(e){this.setPropertyValue("distance",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"strength",{get:function(){return this._adapterO&&this._adapterO.isEnabled("strength")?this._adapterO.apply("strength",this.properties.strength):this.properties.strength},set:function(e){this.setPropertyValue("strength",e)},enumerable:!0,configurable:!0}),t.prototype.getTooltipX=function(){var e=this.getPropertyValue("tooltipX");if(e instanceof c.a||(e=Object(c.c)(50)),e instanceof c.a){var t=this.source,i=this.target;if(t&&i){var r=t.pixelX;return r+(i.pixelX-r)*e.value}}return 0},t.prototype.getTooltipY=function(){var e=this.getPropertyValue("tooltipY");if(e instanceof c.a||(e=Object(c.c)(50)),e instanceof c.a){var t=this.source,i=this.target;if(t&&i){var r=t.pixelY;return r+(i.pixelY-r)*e.value}}return 0},t}(a.a);o.c.registeredClasses.ForceDirectedLink=d;var u=i("2I/e"),h=i("aM7D"),p=i("vMqJ"),f=i("C6dT"),g=i("FzPm"),y=i("p9TX"),v=i("Mtpk"),m=i("+qIf"),b=function(e){function t(){var t=e.call(this)||this;t.className="ForceDirectedNode",t.applyOnClones=!0,t.togglable=!0,t.draggable=!0,t.setStateOnChildren=!0,t.isActive=!1,t.expandAll=!0,t.paddingRadius=0,t.linksWith=new m.a,t._disposers.push(new m.b(t.linksWith)),t.events.on("dragstart",function(){t.dataItem.component&&t.dataItem.component.nodeDragStarted()},t,!1),t.events.on("drag",function(){t.updateSimulation()},t,!1);var i=t.createChild(g.a);i.shouldClone=!1,i.strokeWidth=2;var r=(new s.a).getFor("background");i.fill=r,t.outerCircle=i,i.states.create("hover").properties.scale=1.1;var n=i.states.create("active");n.properties.scale=1.1,n.properties.visible=!0,i.states.create("hoverActive").properties.scale=1;var a=t.createChild(g.a);a.states.create("active").properties.visible=!0,a.shouldClone=!1,a.interactionsEnabled=!1,a.hiddenState.properties.radius=.01,a.events.on("validated",t.updateSimulation,t,!1),a.hiddenState.properties.visible=!0,t.circle=a,t.addDisposer(a.events.on("validated",t.updateLabelSize,t,!1)),t._disposers.push(t.circle);var o=t.createChild(y.a);return o.shouldClone=!1,o.horizontalCenter="middle",o.verticalCenter="middle",o.fill=r,o.strokeOpacity=0,o.interactionsEnabled=!1,o.textAlign="middle",o.textValign="middle",t.label=o,t.adapter.add("tooltipY",function(e,t){return-t.circle.pixelRadius}),t}return Object(n.c)(t,e),t.prototype.updateLabelSize=function(){if(this.label.text){var e=this.circle,t=e.pixelRadius,i=e.defaultState.properties.radius;v.isNumber(i)&&(t=i),this.label.width=2*t,this.label.height=2*t}},t.prototype.copyFrom=function(t){e.prototype.copyFrom.call(this,t),this.circle&&this.circle.copyFrom(t.circle),this.label&&this.label.copyFrom(t.label),this.outerCircle&&this.outerCircle.copyFrom(t.outerCircle)},t.prototype.setActive=function(t){var i=this;e.prototype.setActive.call(this,t);var r=this.dataItem;if(r){var n=r.children,a=r.component;a.dataItemsInvalid||(t&&n&&!r.childrenInited&&(a.initNode(r),a.updateNodeList()),t?(n&&n.each(function(e){e.node.show(),e.node.interactionsEnabled=!0,e.parentLink&&e.parentLink.show(),i.expandAll?e.node.isActive=!0:e.node.isActive=!1}),r.dispatchVisibility(!0)):(n&&n.each(function(e){e.parentLink&&e.parentLink.hide(),e.node.isActive=!1,e.node.interactionsEnabled=!1,e.node.hide()}),r.dispatchVisibility(!1)))}this.updateSimulation()},t.prototype.updateSimulation=function(){var e=this.dataItem;e&&e.component&&e.component.restartSimulation()},Object.defineProperty(t.prototype,"expandAll",{get:function(){return this.getPropertyValue("expandAll")},set:function(e){this.setPropertyValue("expandAll",e)},enumerable:!0,configurable:!0}),t.prototype.linkWith=function(e,t){var i=this.linksWith.getKey(e.uid);if(i||(i=e.linksWith.getKey(this.uid)),!i){var r=this.dataItem,n=r.component;(i=n.links.create()).parent=n,i.zIndex=-1,i.source=this,i.target=e,i.stroke=r.node.fill,i.dataItem=e.dataItem,v.isNumber(t)&&(i.strength=t);var a=n.nodes.indexOf(r.node),o=n.nodes.indexOf(e);n.forceLinks.push({source:a,target:o}),n.updateNodeList(),r.childLinks.push(i),this.linksWith.setKey(e.uid,i)}return i},t.prototype.unlinkWith=function(e){this.linksWith.removeKey(e.uid)},Object.defineProperty(t.prototype,"paddingRadius",{get:function(){return this.getPropertyValue("paddingRadius")},set:function(e){this.setPropertyValue("paddingRadius",e)},enumerable:!0,configurable:!0}),t}(f.a);o.c.registeredClasses.ForceDirectedNode=b;var x=i("hD5A"),k=i("DHte"),S=i("1DgP"),I=i("Gg2j"),O=i("v9UT"),_=i("hJ5i"),P=i("qCRI"),F=i("CnhP"),D=function(e){function t(){var t=e.call(this)||this;return t.childrenInited=!1,t.className="ForceDirectedSeriesDataItem",t.hasChildren.children=!0,t.childLinks=new p.b,t.applyTheme(),t}return Object(n.c)(t,e),t.prototype.show=function(e,t,i){this._visible=!0,this.node&&(this.node.isActive=!0)},t.prototype.dispatchVisibility=function(e){if(this.events.isEnabled("visibilitychanged")){var t={type:"visibilitychanged",target:this,visible:e};this.events.dispatchImmediately("visibilitychanged",t)}},t.prototype.hide=function(e,t,i,r){if(this._visible=!1,this.events.isEnabled("visibilitychanged")){var n={type:"visibilitychanged",target:this,visible:!1};this.events.dispatchImmediately("visibilitychanged",n)}this.node&&(this.node.isActive=!1)},Object.defineProperty(t.prototype,"value",{get:function(){var e=this.values.value.value;return v.isNumber(e)||this.children&&(e=0,this.children.each(function(t){e+=t.value})),e},set:function(e){this.setValue("value",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"node",{get:function(){var e=this;if(!this._node){var t=this.component,i=t.nodes.create();i.draggable=!0,this._node=i,this._disposers.push(i),this._disposers.push(new x.b(function(){t.nodes.removeValue(i)})),this.addSprite(i),i.visible=this.visible,i.hiddenState.properties.visible=!0,t.itemsFocusable()?(this.component.role="menu",i.role="menuitem",i.focusable=!0):(this.component.role="list",i.role="listitem",i.focusable=!1),i.focusable&&(i.events.once("focus",function(r){i.readerTitle=t.populateString(t.itemReaderText,e)},void 0,!1),i.events.once("blur",function(e){i.readerTitle=""},void 0,!1)),i.hoverable&&(i.events.once("over",function(r){i.readerTitle=t.populateString(t.itemReaderText,e)},void 0,!1),i.events.once("out",function(e){i.readerTitle=""},void 0,!1))}return this._node},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"level",{get:function(){return this.parent?this.parent.level+1:0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){var e=this.properties.color;return void 0==e&&this.parent&&(e=this.parent.color),void 0==e&&this.component&&(e=this.component.colors.getIndex(this.component.colors.step*this.index)),e},set:function(e){this.setProperty("color",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkWith",{get:function(){return this.properties.linkWith},set:function(e){this.setProperty("linkWith",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hiddenInLegend",{get:function(){return this.properties.hiddenInLegend},set:function(e){this.setProperty("hiddenInLegend",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collapsed",{get:function(){return this.properties.collapsed},set:function(e){this.setProperty("collapsed",e),this.node.isActive=!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fixed",{get:function(){return this.properties.fixed},set:function(e){this.setProperty("fixed",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"children",{get:function(){return this.properties.children},set:function(e){this.setProperty("children",e)},enumerable:!0,configurable:!0}),t.prototype.createLegendMarker=function(e){this.component.createLegendMarker(e,this),this.node.isActive||this.hide()},Object.defineProperty(t.prototype,"legendDataItem",{get:function(){return this._legendDataItem},set:function(e){this._legendDataItem=e,e.label&&(e.label.dataItem=this),e.valueLabel&&(e.valueLabel.dataItem=this)},enumerable:!0,configurable:!0}),t}(h.b),L=function(e){function t(){var t=e.call(this)||this;return t.className="ForceDirectedSeries",t.d3forceSimulation=S.d(),t.maxRadius=Object(c.c)(8),t.minRadius=Object(c.c)(1),t.width=Object(c.c)(100),t.height=Object(c.c)(100),t.colors=new k.a,t.colors.step=2,t.width=Object(c.c)(100),t.height=Object(c.c)(100),t.manyBodyStrength=-15,t.centerStrength=.8,t.events.on("maxsizechanged",function(){t.updateRadiuses(t.dataItems),t.updateLinksAndNodes(),t.dataItems.each(function(e){t.handleFixed(e)});var e=t.d3forceSimulation,i=I.max(50,t.innerWidth),r=I.max(50,t.innerHeight);e&&(e.force("x",S.e().x(i/2).strength(100*t.centerStrength/i)),e.force("y",S.f().y(r/2).strength(100*t.centerStrength/r)),e.alpha()<.4&&(e.alpha(.4),e.restart()))}),t.applyTheme(),t}return Object(n.c)(t,e),t.prototype.getMaxValue=function(e,t){var i=this;return e.each(function(e){if(e.value>t&&(t=e.value),e.children){var r=i.getMaxValue(e.children,t);r>t&&(t=r)}}),t},t.prototype.validateDataItems=function(){var t=this;if(this.chart.__disabled)e.prototype.validateDataItems.call(this);else{this._dataDisposers.push(new p.c(this.links)),this._maxValue=this.getMaxValue(this.dataItems,0),this.forceLinks=[],this.colors.reset();var i=0,r=Math.min(this.innerHeight/3,this.innerWidth/3);this.dataItems.length<=1&&(r=0),this.dataItems.each(function(e){var n=i/t.dataItems.length*360,a=e.node,o=a.propertyFields.x,s=a.propertyFields.y;o&&v.hasValue(e.dataContext[o])?a.x=e.dataContext[o]:a.x=t.innerWidth/2+r*I.cos(n),s&&v.hasValue(e.dataContext[s])?a.y=e.dataContext[s]:a.y=t.innerHeight/2+r*I.sin(n),e.node.fill=e.color,e.node.stroke=e.color,i++,t.initNode(e)}),this.dataFields.linkWith&&this.dataItems.each(function(e){t.processLinkWith(e)});var n=this.d3forceSimulation;n.on("tick",function(){t.updateLinksAndNodes()});for(var a=0;a<10;a++)n.tick();n.alphaDecay(1-Math.pow(.001,1/600)),this.chart.feedLegend(),e.prototype.validateDataItems.call(this)}},t.prototype.handleFixed=function(e){var t=this,i=e.node,r=i.propertyFields.x,n=i.propertyFields.y;r&&v.hasValue(e.dataContext[r])&&(i.x=e.dataContext[r]),n&&v.hasValue(e.dataContext[n])&&(i.y=e.dataContext[n]),e.fixed?(i.x instanceof c.a?i.fx=O.relativeToValue(i.x,this.innerWidth):i.fx=i.x,i.y instanceof c.a?i.fy=O.relativeToValue(i.y,this.innerHeight):i.fy=i.y,i.draggable=!1,i.validate()):(i.fx=void 0,i.fy=void 0,i.draggable=!0),e&&e.children&&e.children.each(function(e){t.handleFixed(e)})},t.prototype.updateNodeList=function(){var e=this.d3forceSimulation;e.nodes(this.nodes.values),this._linkForce=S.b(this.forceLinks),e.force("link",this._linkForce),this._collisionForce=S.a(),e.force("collision",this._collisionForce);var t=I.max(50,this.innerWidth),i=I.max(50,this.innerHeight);e.force("x",S.e().x(t/2).strength(100*this.centerStrength/t)),e.force("y",S.f().y(i/2).strength(100*this.centerStrength/i))},t.prototype.updateLinksAndNodes=function(){var e=this;this._linkForce&&(this._linkForce.distance(function(t){return e.getDistance(t)}),this._linkForce.strength(function(t){return e.getStrength(t)})),this._collisionForce&&this._collisionForce.radius(function(e){if(e instanceof b){var t=e.circle.pixelRadius;return e.outerCircle.__disabled||e.outerCircle.disabled||!e.outerCircle.visible||(t=(t+3)*e.outerCircle.scale),t+e.paddingRadius}return 1}),this.d3forceSimulation.force("manybody",S.c().strength(function(t){return t instanceof b?t.circle.pixelRadius*e.manyBodyStrength:e.manyBodyStrength}))},t.prototype.getDistance=function(e){var t=e.source,i=e.target,r=0;if(i.dataItem&&t.dataItem){var n=t.linksWith.getKey(i.uid);return n&&(r=n.distance),t.isActive||(r=1),i.isHidden?0:r*(t.circle.pixelRadius+i.circle.pixelRadius)}return r},t.prototype.getStrength=function(e){var t=e.source,i=e.target,r=0,n=t.linksWith.getKey(i.uid);return n&&(r=n.strength),i.isHidden?0:r},t.prototype.nodeDragEnded=function(){this.d3forceSimulation.alphaTarget(0)},t.prototype.nodeDragStarted=function(){this.d3forceSimulation.alpha(.1),this.d3forceSimulation.restart()},t.prototype.restartSimulation=function(){this.d3forceSimulation.alpha()<=.3&&(this.d3forceSimulation.alpha(.3),this.d3forceSimulation.restart())},t.prototype.updateRadiuses=function(e){var t=this;e.each(function(e){t.updateRadius(e),e.childrenInited&&t.updateRadiuses(e.children)})},t.prototype.updateRadius=function(e){var t=e.node,i=(this.innerWidth+this.innerHeight)/2,r=O.relativeToValue(this.minRadius,i),n=O.relativeToValue(this.maxRadius,i),a=r+e.value/this._maxValue*(n-r);v.isNumber(a)||(a=r),t.circle.radius=a,t.outerCircle.radius=a+3,t.circle.states.getKey("active").properties.radius=a,t.circle.defaultState.properties.radius=a},t.prototype.initNode=function(e){var t=this,i=e.node;if(i.parent=this,this.updateRadius(e),e.children&&0!=e.children.length?i.cursorOverStyle=P.a.pointer:(i.outerCircle.disabled=!0,i.circle.interactionsEnabled=!0,i.cursorOverStyle=P.a.default),this.dataItemsInvalid&&(e.level>=this.maxLevels-1||e.collapsed))return i.isActive=!1,void this.updateNodeList();if(i.isActive||i.hide(0),this.handleFixed(e),e.children){var r=0;e.childrenInited=!0,1==this.dataItems.length&&0==e.level&&this.colors.next(),e.children.each(function(n){var a=i.linkWith(n.node);n.parentLink=a;var o,s=2*i.circle.pixelRadius+n.node.circle.pixelRadius,l=r/e.children.length*360;n.node.x=i.pixelX+s*I.cos(l),n.node.y=i.pixelY+s*I.sin(l),n.node.circle.radius=0;var c=n.properties.color;o=v.hasValue(c)?c:1==t.dataItems.length&&0==e.level?t.colors.next():e.color,n.color=o,n.node.fill=o,n.node.stroke=o,n.parentLink.stroke=o,t.initNode(n),r++})}i.isActive=!0,i.show(),this.updateNodeList()},t.prototype.processLinkWith=function(e){var t=this;e.linkWith&&_.each(e.linkWith,function(i,r){var n=t.getDataItemById(t.dataItems,i);n&&e.node.linkWith(n.node,t.linkWithStrength)}),e.children&&e.children.each(function(e){t.processLinkWith(e)})},t.prototype.getDataItemById=function(e,t){for(var i=e.length-1;i>=0;i--){var r=e.getIndex(i);if(r.id==t)return r;if(r.children){var n=this.getDataItemById(r.children,t);if(n)return n}}},t.prototype.createDataItem=function(){return new D},Object.defineProperty(t.prototype,"nodes",{get:function(){if(!this._nodes){var e=this.createNode();e.applyOnClones=!0,this._disposers.push(e),this._nodes=new p.e(e),this._disposers.push(new p.c(this._nodes))}return this._nodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"links",{get:function(){if(!this._links){var e=this.createLink();e.applyOnClones=!0,this._disposers.push(e),this._links=new p.e(e),this._disposers.push(new p.c(this._links))}return this._links},enumerable:!0,configurable:!0}),t.prototype.createNode=function(){return new b},t.prototype.createLink=function(){return new d},Object.defineProperty(t.prototype,"minRadius",{get:function(){return this.getPropertyValue("minRadius")},set:function(e){this.setPropertyValue("minRadius",e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxRadius",{get:function(){return this.getPropertyValue("maxRadius")},set:function(e){this.setPropertyValue("maxRadius",e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colors",{get:function(){return this.getPropertyValue("colors")},set:function(e){this.setPropertyValue("colors",e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxLevels",{get:function(){return this.getPropertyValue("maxLevels")},set:function(e){this.setPropertyValue("maxLevels",e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"manyBodyStrength",{get:function(){return this.getPropertyValue("manyBodyStrength")},set:function(e){this.setPropertyValue("manyBodyStrength",e)&&this.restartSimulation()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"centerStrength",{get:function(){return this.getPropertyValue("centerStrength")},set:function(e){this.setPropertyValue("centerStrength",e)&&this.restartSimulation()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkWithStrength",{get:function(){return this.getPropertyValue("linkWithStrength")},set:function(e){this.setPropertyValue("linkWithStrength",e)&&this.restartSimulation()},enumerable:!0,configurable:!0}),t.prototype.createLegendMarker=function(e,t){e.children.each(function(i){var r=t.node;i instanceof F.a&&i.cornerRadius(40,40,40,40),i.defaultState.properties.fill=r.fill,i.defaultState.properties.stroke=r.stroke,i.defaultState.properties.fillOpacity=r.fillOpacity,i.defaultState.properties.strokeOpacity=r.strokeOpacity,i.fill=r.fill,i.stroke=r.stroke,i.fillOpacity=r.fillOpacity,i.strokeOpacity=r.strokeOpacity,void 0==i.fill&&(i.__disabled=!0);var n=e.dataItem;n.color=r.fill,n.colorOrig=r.fill,r.events.on("propertychanged",function(e){"fill"==e.property&&(i.__disabled=!1,i.isActive||(i.fill=r.fill),i.defaultState.properties.fill=r.fill,n.color=r.fill,n.colorOrig=r.fill),"stroke"==e.property&&(i.isActive||(i.stroke=r.stroke),i.defaultState.properties.stroke=r.stroke)},void 0,!1)})},t}(h.a);o.c.registeredClasses.ForceDirectedSeries=L,o.c.registeredClasses.ForceDirectedSeriesDataItem=D;var V=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.c)(t,e),t}(u.b),C=function(e){function t(){var t=e.call(this)||this;return t.className="ForceDirectedTree",t.seriesContainer.isMeasured=!0,t.seriesContainer.layout="absolute",t.applyTheme(),t}return Object(n.c)(t,e),t.prototype.createSeries=function(){return new L},t.prototype.createDataItem=function(){return new V},t.prototype.feedLegend=function(){var e=this.legend;if(e){var t=[];this.series.each(function(i){if(!i.hiddenInLegend){var r=i.dataItems;if(1==r.length){var n=i.dataItems.getIndex(0).children;n.length>0&&(r=n)}r.each(function(r){if(!r.hiddenInLegend){t.push(r);var n=i.legendSettings;n&&(n.labelText&&(e.labels.template.text=n.labelText),n.itemLabelText&&(e.labels.template.text=n.itemLabelText),n.valueText&&(e.valueLabels.template.text=n.valueText),n.itemValueText&&(e.valueLabels.template.text=n.itemValueText))}})}}),e.data=t,e.dataFields.name="name"}},t.prototype.applyInternalDefaults=function(){e.prototype.applyInternalDefaults.call(this),v.hasValue(this.readerTitle)||(this.readerTitle=this.language.translate("Force directed tree"))},t.prototype.getExporting=function(){var t=this,i=e.prototype.getExporting.call(this);return i.adapter.add("formatDataFields",function(e){return"csv"!=e.format&&"xlsx"!=e.format||t.series.each(function(t){v.hasValue(t.dataFields.children)&&delete e.dataFields[t.dataFields.children]}),e}),i},t}(u.a);o.c.registeredClasses.ForceDirectedTree=C,o.c.registeredClasses.ForceDirectedTreeDataItem=V,window.am4plugins_forceDirected=r}},["eUZ+"]);
//# sourceMappingURL=forceDirected.map.js